import { ApiProperty } from '@nestjs/swagger'
import { IsEmail, IsNotEmpty } from 'class-validator'
import { PickType } from '@nestjs/mapped-types'
import { LoginUserDto } from './login-user.dto'

export class RegisterUserDto extends PickType(LoginUserDto, ['username', 'password']) {
  @IsNotEmpty({ message: '昵称不能为空' })
  @ApiProperty()
  nickName: string

  @IsNotEmpty({ message: '邮箱不能为空' })
  @IsEmail({}, { message: '不是合法的邮箱格式' })
  @ApiProperty()
  email: string

  @IsNotEmpty({ message: '验证码不能为空' })
  @ApiProperty()
  captcha: string

  @IsNotEmpty({ message: '角色不能为空' })
  @ApiProperty()
  roles: string[]
}
